var http = require('http');
var url = require('url');
var util = require('util');
var sha1 = require('sha1');
var fs = require('fs');
var querystring = require('querystring');
var routeToGet = require('./route/routeToGet');
var routeToPost = require('./route/routeToPost');

http.createServer(function(req, res) {
	// var query = url.parse(req.url, true).query;
	// res.write(util.inspect(query));
	// console.log(util.inspect(query))
	if (req.method == "GET") {
		
		routeToGet(req, res);

	} else if (req.method == "POST") {

		routeToPost(req, res);

	}
	// res.end();
}).listen(80)
http.createServer(function(req, res) {
	// var query = url.parse(req.url, true).query;
	// res.write(util.inspect(query));
	// console.log(util.inspect(query))
	if (req.method == "GET") {
		
		routeToGet(req, res);

	} else if (req.method == "POST") {

		routeToPost(req, res);

	}
	// res.end();
}).listen(8012)

console.log('-------------------------' +
	'Server running at http://127.0.0.1:80/-------------------------');
